<template>
	<view class="container">
		<van-tabs swipeable sticky animated @change="change">
			<van-tab v-for="(item, index) in type" :title="item" :key="index">
				
				<view class="uni-list  tab-container">
					<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(value,key) in orders" :key="key">
						<view class="uni-media-list">
							<view class="uni-media-list-logo">
								<image v-if="true" :src="value.img"></image>
							</view>
							<view class="uni-media-list-body" @click="">
								<view class="uni-media-list-text-top">{{value.title}}</view>
								<view class="uni-media-list-text-bottom uni-ellipsis">{{value.content}}</view>
							</view>
						</view>
					</view>
				</view>
				
			</van-tab>
		</van-tabs>

	</view>
</template>

<script>
	import {
		mapState, 
		mapGetters,
		mapMutations,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				
				type: ['全部','待发货','待收货','已完成'],
				addressList: [{
						id: 1,
						linkMan: '小明',
						mobile: '10086',
						address: '北京市西城区动物园'
					},
					{
						id: 2,
						linkMan: '小红',
						mobile: '10010',
						address: '北京市海淀区植物园',
						isDefault:true
					},
					{
						id: 3,
						linkMan: '小刚',
						mobile: '10001',
						address: '广东省广州长隆动物园'
					
					}
				]
			}
		},
		computed: {
			...mapGetters(["orders"])
		},
		onLoad() {
			this.getOrder({page: 1, per_page: 10, status: "999"});
		},
		methods: {
			...mapActions(['getOrder']),
			change(event) {
				let index = event.detail.index;
				let status = "999"
				if(index!==0){
					status = (parseInt(index)-1)+""
				}
				this.getOrder({page: 1, per_page: 10, status: status});
				console.log(event);
			},
			selectTap(id) {
				console.log("tap item id:" + JSON.stringify(id));
			},
			editAddess(id) {
				console.log("edit item id:" + id);
			},
			addAddess() {
				console.log("tap add new Address");
			}
		}
	}
</script>

<style>
	.container {
		background-color: #F2f2f2;
	}

	.address-list {
		width: 100%;
		background-color: #fff;
		margin-top: 20upx;
		padding-bottom: 100upx;
	}

	.address-list .a-address {
		width: 720upx;
		margin-left: 30upx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30upx 0;
		border-bottom: 1upx solid #eee;
	}

	.a-address .left-text {
		width: 610upx;
		box-sizing: border-box;
		padding-left: 58upx;
	}

	.a-address .left-text.active {
		background: url() no-repeat left center;
		background-size: 28upx auto;
	}

	.a-address .left-text .name-tel {
		margin-bottom: 20upx;
	}

	.a-address .left-text .address-box {
		font-size: 24upx;
		color: #888888;
		line-height: 36upx;
	}

	.a-address .right-edit {
		width: 109upx;
		height: 100%;
		padding: 50upx 0 50upx 58upx;
		box-sizing: border-box;
		background: url() no-repeat 43upx center;
		background-size: 35upx auto;
	}
	
	.bottom-box {
		position: fixed;
		width: 100%;
		bottom: 0;
		font-size: 28upx;
		color: #000000;
		border-top: 1upx solid #eee;
		height: 100upx;
		line-height: 100upx;
		background: #fff url() no-repeat 705upx center;
		background-size: 15upx auto;
	}

	.bottom-box .add-btn {
		margin-left: 30upx;
		padding-left: 70upx;
		background: url() no-repeat left center;
		background-size: 40upx auto;
	}
</style>
